Ext.define("jwawa.erp.framework.ShellContainer", {
    extend: 'Ext.panel.Panel',
    alias: 'widget.shell',
    handlerClass: null,
    handler:null,
    border: false,
    layout: {type: 'fit'},
    pageState:null,
    preventHeader: true,
    constructor: function(params){
        var me = this,
            handler;

        if(Ext.isString(me.handlerClass)){
            handler = Ext.create(me.handlerClass, {
                view: me
            });
            me.handler = handler;
        }

        me.callParent(arguments);
    },

    initComponent: function() {
        var me = this,
            handler = me.handler;

        me.addEvents('containerClose');

        if(handler){
            handler.beforeInitComponent();
        }

        me.callParent(arguments);
        me.addEvents('pageStateChange');

        if(handler){
            handler.beforeBindHandler();
            handler.bindHandler();
            handler.afterBindHandler();
            handler.afterInitComponent();
        }
    },

    setPageState: function(newPageState){
        var me = this;

        var oldPageState = me.pageState;
        me.pageState = newPageState;
        me.fireEvent('pageStateChange', me, newPageState, oldPageState);
    }
});